<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>列表排序</title>

  <!-- 引入Vue -->
  <script type="text/javascript" src="/vue/vue.js"></script>

</head>
<body>
  <!-- 创建一个容器 -->
  <div id="app">
    <button @click="updataMei">点击按钮更马东梅的信息</button>
    <ul>
      <li v-for="item of person" :key="item.id">
        {{`${item.name}-${item.sex}-${item.age}`}}
      </li>
    </ul>

  </div>

  <script type="text/javascript">
    // 创建一个Vue实例
     const vm =  new Vue({
      el: '#app',
      data: {
        keywords: '',
        type: 0,
        person: [
          { id: '001', name: '马冬梅', sex: '女', age: 23},
          { id: '002', name: '周冬雨', sex: '女', age: 18},
          { id: '003', name: '周杰伦', sex: '男', age: 20},
          { id: '004', name: '温兆伦', sex: '男', age: 30},
        ],
      },
      methods: {
        updataMei() {
          console.log(1);
          this.person[0].name = '马老师';
          this.person[0].sex = '男';
          this.person[0].age = '20';

          // this.person[0] = { id: '001', name: '马老师', sex: '男', age: 24}; // 该方式vue检测不到变化
        }
      }
    })
  </script>
</body>
</html>